# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer:
pkgname=ocaml-reactivedata
_pkgname=reactiveData
pkgver=0.2.1
pkgrel=2
pkgdesc="FRP with incremental changes in data structures for OCaml"
url="https://github.com/ocsigen/reactiveData/"
arch="all !x86 !armhf !armv7 !s390x !mips !mips64"  # limited by ocaml aport
license="LGPL-2.1-or-later-WITH-linking-exception"
depends="ocaml-react ocaml-runtime"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="ocaml ocaml-findlib ocaml-react-dev ocamlbuild opam"
options="!check"  # no tests provided
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/ocsigen/$_pkgname/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	cd "$builddir"
	make
}

package() {
	cd "$builddir"

	opam-installer -i \
		--prefix="$pkgdir/usr" \
		--libdir="$pkgdir/usr/lib/ocaml" \
		--docdir="$builddir/.omit" \
		$_pkgname.install

	# Remove annotation files.
	rm -Rf "$pkgdir"/usr/lib/ocaml/$_pkgname/*.cmt*
}

dev() {
	local sitelib="usr/lib/ocaml/$_pkgname"
	default_dev

	cd "$pkgdir"/$sitelib

	mkdir -p "$subpkgdir"/$sitelib
	mv *.cmx *.cmxa *.mli "$subpkgdir"/$sitelib/
}

sha512sums="e4dad870fd1f669566394d9c2ab52665a3d27f6b2dd3807dba245d89ca90eda08b98b266fb0795bcfa5cb4ffed7a86aa719f8db5c316b0d920ee3c342493d029  ocaml-reactivedata-0.2.1.tar.gz"
